#include <cstdio>
#include <cstring>

int n, x, y, a[ 51 ], b[ 51 ], f[ 51 ][ 201 ];

int max( int c, int d ) { return ( c > d ) ?c :d; }

void init( )
{
    int i;
    scanf("%d%d%d", &n, &x, &y);
    for ( i = 0; i < n; i++ )
        scanf("%d%d", &a[ i ], &b[ i ]);
}

bool check( int m )
{
    int i, j, k;
    for ( i = 0; i <= n; i++ )
        for ( j = 0; j <= x; j++ )
            f[ i ][ j ] = -10000000;
    f[ 0 ][ 0 ] = 0;
    for ( i = 1; i <= n; i++ )
    {
        for ( j = 0; j <= x; j++ )
        {
            for ( k = 0; k <= j; k++ )
            {
                if ( ( j - k ) * a[ i - 1 ] > m )
                    continue;
                f[ i ][ j ] = max( f[ i ][ j ], f[ i - 1 ][ k ] + ( m - ( j - k ) * a[ i - 1 ] ) / b[ i - 1 ] );
        //        if ( i == 1 && m == 5 ) printf("!%d %d %d %d\n", j, k, f[ i ][ j ], f[ i - 1 ][ k ]);
            }
        }
    }
    /*if ( m == 5 )
        for ( i = 0; i <= n; i++ )
        {
            for ( j = 0; j <= x; j++ )
                printf("%d ", f[ i ][ j ]);
            printf("\n");
        }*/
    return f[ n ][ x ] >= y;
}

void work( )
{
    int left = 0, right = 400000, mid;
    while ( left < right )
    {
        mid = ( left + right ) / 2;
        if ( !check( mid ) )
            left = mid + 1;
        else
            right = mid;
    }
    printf("%d\n", left);
}

int main( )
{
    int t, cas = 1;
    scanf("%d", &t);
    while ( t-- )
    {
        init( );
        printf("Case %d: ", cas++);
        work( );
    }
    return 0;
}
